	
	function dejarDeSeguir() {
		//if (cuentaSelectSegui != '-1' && confirm('Desea dejar el seguimiento actual?')) {
		if(misVehiculosHash.size()>0){
			if (cMapController.getMapActive().getCuentaSeguimiento() != '-1' && confirm('Desea dejar el seguimiento actual?')) {
				cMapController.getMapActive().noSeguirMovil();
				return true;
			}
		}
		return false;

	}

	//dado un elemento, verifica que este exista en un array y retorna la posicion, o -1 en caso contrario.
	function existeEnArray(element, lista){
		for(var i=0; i<lista.length; i++){
	   	   if(lista[i]==element){
	     	 return i;
	   		}
		}
		return -1;	
	}


	function showDiv(divId) {
  		document.getElementById(divId).style.display = "block";
	}
 
	
	function hideDiv(divId) {
  		document.getElementById(divId).style.display = "none";
	}
	
	function indexOfArray(arrays, obj){
		for(var i=0; i<arrays.length; i++){
	        if(arrays[i]==obj){
	            return i;
	        }
	    }
	    return -1;	
	}
	
	function createElem(opt_className, opt_html, opt_tagName) {
		tag = opt_tagName||"div";
		elem = document.createElement(tag);
		if (opt_html) elem.innerHTML = opt_html;
		if (opt_className) elem.className = opt_className;
	    return elem;
	}	
	
	function checkAllOptions(boxId, checkedValue, opt_functionName){
		var fields = document.getElementsByName(boxId);
		for (i = 0; i < fields.length; i++){
			if (fields[i].checked!=checkedValue){
				fields[i].click();
				if( opt_functionName!=null)
					call(opt_functionName)(fields[i]);
				}
			}
	}

	//GLOBAL HIGLIGHT-CIRCLE
	//Circulo que se dibuja temporariamente para demarcar una posicion LONLAT
	var highlightCircleLayer = null;
	var highlightCircleTimeOut = 0;
	
	function removeHighlightCircle(){
		if (highlightCircleLayer){ 
			cMapController.getMapActive().getMap().removeLayer(highlightCircleLayer); 
			highlightCircleLayer=null;
		}
	}
	
	function putHighlightCircle(LonLat, color){	
		var bgColor = "#FFFFFF";
		if (color)
			bgColor = color;
		if (highlightCircleLayer) {
   		    cMapController.getMapActive().getMap().removeLayer(highlightCircleLayer);
      	}	
		//Openlayers.Geometry.Point	
		var origin = new OpenLayers.Geometry.Point(LonLat.lon,LonLat.lat);
		//create Regular Polygon Geometry
		var radio = cMapController.getMapActive().getMap().getExtent().getHeight()/20;
		var objF = OpenLayers.Geometry.Polygon.createRegularPolygon(origin, radio, 20, 90);
		//create vector layer
		highlightCircleLayer = new OpenLayers.Layer.Vector("highlightCircle");

		cMapController.getMapActive().getMap().addLayer(highlightCircleLayer);
		//create feature
		var theFeature = new OpenLayers.Feature.Vector(objF,null,{
            strokeColor: "#202020",
			fillColor: bgColor,
            strokeOpacity: 0.6,
			fillOpacity: 0.6,
            strokeWidth: 1
        });
		//add feature
		highlightCircleLayer.addFeatures(theFeature);
		//set timeOut for the feature
		clearTimeout(highlightCircleTimeOut);
		highlightCircleTimeOut = setTimeout ( "removeHighlightCircle();", 5000);
	}
	
	function distanciaEntrePuntos(lat1, lon1, lat2, lon2) {						
		var movilLat = parseFloat(lat1);
		var movilLon = parseFloat(lon1);
		if (isNaN(movilLat)||isNaN(movilLon)) return null;
		var ptoLat = parseFloat(lat2);
		var ptoLon = parseFloat(lon2);
		if (isNaN(ptoLat)||isNaN(ptoLon)) return null;
		var R = 6371; // km, radio de la tierra
		var dLat = (movilLat-ptoLat)*(Math.PI / 180);
		var dLon = (movilLon-ptoLon)*(Math.PI / 180); 
		var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
        		Math.cos(movilLat*(Math.PI / 180)) * Math.cos(ptoLat*(Math.PI / 180)) * 
        		Math.sin(dLon/2) * Math.sin(dLon/2); 
		var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
		var d = R * c;
		return d;
	}
	
	
	function distanciaEntrePuntosPitagoras(lat1, lon1, lat2, lon2) {						
		var movilLat = parseFloat(lat1);
		var movilLon = parseFloat(lon1);
		if (isNaN(movilLat)||isNaN(movilLon)) return null;
		var ptoLat = parseFloat(lat2);
		var ptoLon = parseFloat(lon2);
		if (isNaN(ptoLat)||isNaN(ptoLon)) return null;
		var a = Math.pow((movilLat - ptoLat),2);
	  	var b = Math.pow((movilLon - ptoLon),2);
	  	var c = a + b;
	  	c = Math.sqrt(c) * 100;
	  	c = c.toFixed(4);
	  	c = parseFloat(c);
	  	return c;
	}
		